<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all">
    <script th:src="@{/plugins/layui/layui.js}"></script>
    <title>修改车辆</title>
</head>
<body>
<div style="padding-top: 20px;padding-right: 150px;padding-left: 100px;">
    <form class="layui-form">
        <input type="hidden" name="id" th:value="${param.id}">
        <div class="layui-form-item">
            <label class="layui-form-label">物流公司</label>
            <div class="layui-input-block">
                <select id="tLogisticsid" name="tLogisticsid" lay-filter="tLogisticsid" >
                    <option  th:each="l:${list}" th:value="${l.id}" th:text="${l.companyName}" th:selected="${#strings.contains(l.id,param.tlogisticsid)}"></option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">驾驶员编号</label>
            <div class="layui-input-block">
                <select id="tDriverid" name="tDriverid" lay-filter="tDriverid">
                    <option th:each="b:${dlist}" th:value="${b.TDriverid}" th:text="${b.TDrivername}"
                            th:selected="${#strings.contains(b.TDriverid,param.tdriverid)}" ></option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">车牌号</label>
            <div class="layui-input-block">
                <input type="text" name="tLicenseplate" required lay-verify="required|tLicenseplate" placeholder="车牌号" autocomplete="off"
                       class="layui-input" th:value="${param.tlicenseplate}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">车辆类型</label>
            <div class="layui-input-block">
                <input type="text" name="tVehicletype" required lay-verify="required|tVehicletype" placeholder="车辆类型" autocomplete="off"
                       class="layui-input" th:value="${param.tvehicletype}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">车辆名称</label>
            <div class="layui-input-block">
                <input type="text" name="tVehiclename" required lay-verify="required|tVehiclename" placeholder="车辆名称" autocomplete="off"
                       class="layui-input" th:value="${param.tvehiclename}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">车辆载重</label>
            <div class="layui-input-block">
                <input type="text" name="tVehicleload" required lay-verify="required|tVehicleload" placeholder="车辆载重" autocomplete="off"
                       class="layui-input" th:value="${param.tvehicleload}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">车辆尺寸</label>
            <div class="layui-input-block">
                <input type="text" name="tVehiclesize" required lay-verify="required|tVehiclesize" placeholder="车辆尺寸" autocomplete="off"
                       class="layui-input" th:value="${param.tvehiclesize}">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use('form', function() {
        var form = layui.form;
        var $ = layui.jquery;
        form.on('submit(formDemo)', function(data){
            $.ajax({
                url:"/vehicle/v_update",
                data:data.field,
                dataType:'json',
                type:'post',
                async: false,
                success:function(mydata){
                    if (mydata) {
                        parent.layui.table.reload("demo");
                        parent.layer.msg('修改成功', {icon: 1});
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    }
                }
            });
        })
    })
    form.verify({
        tLicenseplate:[
            /^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$/, '您的输入有误，请输入正确的车牌号'
        ]

    })
</script>
</body>
</html>